Optimal. Leaf size=30 \[ -\frac {a^2 x^{-n}}{n}+\frac {b^2 x^n}{n}+2 a b \log (x) \]
[Out]
________________________________________________________________________________________
Rubi [A]
time = 0.01, antiderivative size = 30, normalized size of antiderivative = 1.00, number of steps
used = 3, number of rules used = 2, integrand size = 17, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.118, Rules used = {272, 45}
\begin {gather*} -\frac {a^2 x^{-n}}{n}+2 a b \log (x)+\frac {b^2 x^n}{n} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
Rule 45
Rule 272
Rubi steps
\begin {align*} \int x^{-1-n} \left (a+b x^n\right )^2 \, dx &=\frac {\text {Subst}\left (\int \frac {(a+b x)^2}{x^2} \, dx,x,x^n\right )}{n}\\ &=\frac {\text {Subst}\left (\int \left (b^2+\frac {a^2}{x^2}+\frac {2 a b}{x}\right ) \, dx,x,x^n\right )}{n}\\ &=-\frac {a^2 x^{-n}}{n}+\frac {b^2 x^n}{n}+2 a b \log (x)\\ \end {align*}
________________________________________________________________________________________
Mathematica [A]
time = 0.03, size = 31, normalized size = 1.03 \begin {gather*} -\frac {a^2 x^{-n}-b^2 x^n-2 a b \log \left (x^n\right )}{n} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
Maple [A]
time = 0.22, size = 31, normalized size = 1.03
method | result | size |
risch | \(-\frac {a^{2} x^{-n}}{n}+\frac {b^{2} x^{n}}{n}+2 a b \ln \left (x \right )\) | \(31\) |
norman | \(\left (\frac {b^{2} {\mathrm e}^{2 n \ln \left (x \right )}}{n}+2 a b \ln \left (x \right ) {\mathrm e}^{n \ln \left (x \right )}-\frac {a^{2}}{n}\right ) {\mathrm e}^{-n \ln \left (x \right )}\) | \(43\) |
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Maxima [A]
time = 0.29, size = 30, normalized size = 1.00 \begin {gather*} 2 \, a b \log \left (x\right ) + \frac {b^{2} x^{n}}{n} - \frac {a^{2}}{n x^{n}} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Fricas [A]
time = 0.42, size = 34, normalized size = 1.13 \begin {gather*} \frac {2 \, a b n x^{n} \log \left (x\right ) + b^{2} x^{2 \, n} - a^{2}}{n x^{n}} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Sympy [B] Leaf count of result is larger than twice the leaf count of optimal. 178 vs.
\(2 (24) = 48\).
time = 2.58, size = 178, normalized size = 5.93 \begin {gather*} \begin {cases} a^{2} x + 2 a b \log {\left (x \right )} - \frac {b^{2}}{x} & \text {for}\: n = -1 \\\left (a + b\right )^{2} \log {\left (x \right )} & \text {for}\: n = 0 \\- \frac {a^{2} n}{n^{2} x^{n} + n x^{n}} - \frac {a^{2}}{n^{2} x^{n} + n x^{n}} - \frac {2 a b n x^{n} \log {\left (x^{- n} \right )}}{n^{2} x^{n} + n x^{n}} + \frac {2 a b n x^{n}}{n^{2} x^{n} + n x^{n}} - \frac {2 a b x^{n} \log {\left (x^{- n} \right )}}{n^{2} x^{n} + n x^{n}} + \frac {b^{2} n x^{2 n}}{n^{2} x^{n} + n x^{n}} + \frac {b^{2} x^{2 n}}{n^{2} x^{n} + n x^{n}} & \text {otherwise} \end {cases} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [A]
time = 2.31, size = 34, normalized size = 1.13 \begin {gather*} \frac {2 \, a b n x^{n} \log \left (x\right ) + b^{2} x^{2 \, n} - a^{2}}{n x^{n}} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Mupad [B]
time = 1.32, size = 30, normalized size = 1.00 \begin {gather*} 2\,a\,b\,\ln \left (x\right )+\frac {b^2\,x^n}{n}-\frac {a^2}{n\,x^n} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________